package inherit;

//Car组合

//轮胎类
class Tire {

}
//发动机类
class Engine {

}
//组合了Tire和Engine类
public class Car {
    private Tire tire;      //可以复用轮胎中的属性和方法
    private Engine engine;  //可以复用发动机中的属性和方法

}
//奔驰是汽车
class Benz extends Car {
    //继承了汽车的共性，如轮胎，发动机等全部继承
}

//School组合

class Student {
    private String name;

    public Student(String name) {
        this.name=name;
    }
}
class Teacher {
    private String name;

    public Teacher(String name) {
        this.name=name;
    }
}

class School {
    //字段(属性)
    public Student[] students;
    public Teacher[] teachers;

    public static void main(String[] args) {

    }
}

